<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" encoding="UTF-8" indent="no"/>
<!--
<![CDATA[
用途：实体类生成模板
创建日期：2010-08-01
修改人：王浚冰
修改日期：2010-08-01
修改位置：
]]>
-->
<xsl:template match="/">﻿using System;
  using System.Collections.Generic;
  using formworks.DBO.Attributes;
  
  namespace entity
  {
	/// <summary>
    /// 实体类：<xsl:value-of select="/node()/@table"/>
    /// 数据库名称：<xsl:value-of select="/node()/@table"/>
    /// 描述：<xsl:value-of select="/node()/@name"/>的实体类
    ///</summary>
    [TableEntity("<xsl:value-of select="/node()/@table"/>", "<xsl:value-of select="/node()/@name"/>")]
    public class <xsl:value-of select="/node()/@table"/>
    {        
        <xsl:for-each select="//Table"><xsl:variable name="NAME" select="name"/>
        /// <summary>
        /// <xsl:value-of select="description"/>
        /// </summary>
        [Fields("<xsl:value-of select="name"/>", "<xsl:value-of select="dataType"/>", <xsl:value-of select="maxLength"/>, <xsl:value-of select="isNullAble"/>, <xsl:value-of select="isIdentity"/>, "<xsl:value-of select="description"/>")]
        <xsl:if test="not(constraint_keys) = false()">
        [Constraints(<xsl:value-of select="constraint_type_code"/>, "<xsl:value-of select="constraint_name"/>", "<xsl:value-of select="constraint_keys"/>", "<xsl:value-of select="constraint_ref"/>", "")]
        </xsl:if>
        public <xsl:value-of select="csharpDataType"/> <xsl:text disable-output-escaping="no"> </xsl:text><xsl:value-of select="name"/> { get; set; }
      
        <xsl:if test="not(constraint_ref_entity) = false()">
        /// <summary>
        /// <xsl:value-of select="description"/>（<xsl:value-of select="constraint_keys"/>）的引用实现实体对象
        /// </summary>
        [References("<xsl:value-of select="constraint_keys"/>", "<xsl:value-of select="constraint_ref_id"/>", "<xsl:value-of select="constraint_ref"/>")]
        public <xsl:value-of select="constraint_ref_entity"/><xsl:text disable-output-escaping="no"> </xsl:text> ref_<xsl:value-of select="constraint_ref_entity"/> { get; set; }
        </xsl:if>
      
      </xsl:for-each>

    }//end <xsl:value-of select="/node()/@table"/> <xsl:value-of select="/node()/@name"/>

}//end namespace entity



  </xsl:template>
</xsl:stylesheet>
